<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>旅行社管理系统 - 仪表盘</title>
    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Bootstrap Icons -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css">
    <link rel="stylesheet" href="css/main.css">
    <!-- Vue.js -->
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14"></script>
    <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
</head>
<body>
    <div id="app">
        <div class="container-fluid">
            <div class="row">
                <sidebar-nav 
                    current-page="dashboard"
                    @logout="handleLogout">
                </sidebar-nav>
                <!-- 主内容区 -->
                <main class="col-md-9 ms-sm-auto col-lg-10 px-md-4">
                    <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
                        <h1 class="h2">仪表盘</h1>
                    </div>
                    <!-- 这里放置仪表盘内容 -->
                </main>
            </div>
        </div>
    </div>

    <!-- Bootstrap Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
    <script src="js/api/config.js"></script>
    <script src="js/components/Sidebar.js"></script>
    <script>
        new Vue({
            el: '#app',
            data: {
                currentUser: null,
                isAdmin: false
            },
            created() {
                // 检查登录状态
                const token = localStorage.getItem(API_CONFIG.TOKEN_KEY);
                if (!token) {
                    window.location.href = '/index.html';
                    return;
                }

                // 获取用户信息
                const userStr = localStorage.getItem(API_CONFIG.USER_KEY);
                if (userStr) {
                    this.currentUser = JSON.parse(userStr);
                    this.isAdmin = this.currentUser.role === 'admin';
                }
            },
            methods: {
                handleLogout() {
                    localStorage.removeItem(API_CONFIG.TOKEN_KEY);
                    localStorage.removeItem(API_CONFIG.USER_KEY);
                    window.location.href = '/index.html';
                }
            }
        });
    </script>
</body>
</html> 